[KV Offload] Fix multi-node KV offloading state desynchronization and JAX dispatch…#2983
Draft
amitkumar307d wants to merge 2 commits into
Draft
[KV Offload] Fix multi-node KV offloading state desynchronization and JAX dispatch…#2983amitkumar307d wants to merge 2 commits into
amitkumar307d wants to merge 2 commits into
Conversation
10e7c53 to
2c9a4f4
Compare
… order Signed-off-by: Amit Kumar <amitmkumar@google.com>
3dd4d98 to
a53270c
Compare
Signed-off-by: Amit Kumar <amitmkumar@google.com>
b165061 to
ae9438f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes state desynchronization, JAX dispatch deadlocks, and resource leaks in Multi-Node KV Offloading, ensuring stability during high-concurrency benchmarks.
Context & Problem:
Previously, running high-concurrency benchmarks (like
prefix_repetition) on large models (e.g., Qwen3-Coder 480B) with multi-node KV offloading enabled led to fatal crashes (AssertionError) and runtime hangs.jax.device_put(D2H) in background threads caused non-deterministic dispatch orders across nodes, leading to low-level TPU runtime halts.OrderedDictbacking theLocalCPUBackendcaused structural corruption under high load.Solution
KVOffloadConnectorStats.aggregateusingcollections.Counterand the union (|) operator to correctly merge completion signals across all worker nodes without artificially multiplying chunk counts.KVOffloadConnectorStats.num_finished_blocksto accurately count total finished chunks instead of just request entries.jax.device_put(D2H dispatch) from background threads to the main thread inTPUOffloadConnectorWorker.start_save_kv(and batched version) to ensure globally aligned dispatch order across all TPU nodes.chunk_hashesinOffloadManager.allocate_for_saveto ensure only oneCPUChunkis allocated per unique content hash in a batch.remove()withdiscard()inupdate_connector_outputto handle redundant or late completion signals gracefully without crashing the engine._local_in_flight_savesand blocks (future.result()) duringstart_load_kvif a Load is requested for a chunk still being saved locally.LocalCPUBackendby wrapping critical sections (add, get, reclaim) withthreading.Lockto protect the underlying dictionary from concurrent corruption.Tests
prefix_repetitionbenchmarks under high concurrency.AssertionErrorstate desync is resolved and the server runs to completion without JAX runtime hangs.Qwen3-Coder 480B - Server command:
python3 -m vllm.entrypoints.openai.api_server \ --host=0.0.0.0 \ --port=8000 \ --tensor-parallel-size=16 \ --max-model-len=102400 \ --load-format=runai_streamer \ --kv-cache-dtype=fp8 \ --gpu-memory-utilization=0.8 \ --data-parallel-size=1 \ --max-num-batched-tokens=16384 \ --max-num-seqs=512 \ --model=Qwen/Qwen3-Coder-480B-A35B-Instruct \ --served-model-name=Qwen/Qwen3-Coder-480B-A35B-Instruct \ --enable-prefix-caching \ --async-scheduling \ --enable-expert-parallel \ --kv-transfer-config='{"kv_connector": "TPUOffloadConnector", "kv_connector_module_path": "tpu_inference.offload.tpu_offload_connector","kv_role": "kv_both", "kv_connector_extra_config": {"cpu_bytes_to_use": 107374182400, "lazy_offload": false}}'Qwen3-Coder-480B - Client Command:
vllm bench serve --backend=openai --model=Qwen/Qwen3-Coder-480B-A35B-Instruct --dataset-name=prefix_repetition --host=localhost --port=8000 --seed=123 --num-prompts=32 --max-concurrency=32 --prefix-repetition-prefix-len=19424 --prefix-repetition-suffix-len=32 --prefix-repetition-output-len=1024 --prefix-repetition-num-prefixes=4 --percentile-metrics='ttft,tpot,itl,e2el' --ignore-eosLogs:
Results:
Checklist